﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QLNSClient
{
    public partial class Frm_dsHSL : DevExpress.XtraEditors.XtraForm
    {
        QLNSServiceReference.QLNSServiceClient sv = new QLNSServiceReference.QLNSServiceClient();
        
        public Frm_dsHSL()
        {
            InitializeComponent();
        }

        private void Frm_dsHSL_Load(object sender, EventArgs e)
        {
            gv_dsHSL.DataSource = sv.getHSL();
            gridView1.Columns[0].Caption = "Mã loại ngạch";
            gridView1.Columns[1].Caption = "Mã bậc lương";
            gridView1.Columns[2].Caption = "Hệ số lương";
        }

        private void themHSL(object sender, EventArgs e)
        {
            splashScreenManager1.ShowWaitForm();
            Frm_HSL frm = new Frm_HSL();
            frm.Show();
            splashScreenManager1.CloseWaitForm();
        }

        private void gridView1_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
        {
            try
            {
                e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Thêm hệ số lương mới", themHSL));
            }
            catch
            {
                MessageBox.Show("Bạn cần click vào dòng dữ liệu!","Cảnh báo",MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
    }
}